package com.atguigu.myjuc.mythread.day2;

import java.util.Random;
import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.SynchronousQueue;

//达到count时放行
public class CountDownLatchDemo {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch latch = new CountDownLatch(6);

        for (int i = 0; i < 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"离开");
                latch.countDown();
            }, String.valueOf(i)).start();
        }
        latch.await();
        System.out.println("锁门");
        }


}
